using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using labDict.Web.common;
using labDict.Web.provider;

namespace labDict.Web.business
{
    public class LabTestBO
    {
        public enum DDLType
        {
            CONTAINER_ID,
            DIVISION_ID,
            FUNC_AREA_ID,
            SPEC_TYPE_ID,
            SPECIMEN_TYPE_ID,
            TESTING_SCHEDULE_ID,
            WEB_TAT_ID,
            REF_CONV_ID,
            METHOD_ID,
            INTERNATIONAL_UNIT_ID,
            ULT_REQ_ID,
            DOWN_REQ_ID,
            SHIPPING_ID,
            WEBDISCLAIMER_ID,
            WEBDISPLAY
        }

        private LabTestBO() { }

        public static SqlDataReader GetLabTests()
        {
            return LabTestDA.GetLabTests();
        }

        public static LabTest GetLabTest(decimal decLabTestID)
        {
            LabTest lt = LabTestDA.GetLabTest(decLabTestID);
            
            return lt;
            
        }

        public static void Insert(LabTest tst)
        {
            LabTestDA.Insert(tst);
        }

        public static void Update(LabTest tst)
        {
           LabTestDA.Update(tst);
        }

        public static DDLContainer GetDDLItems(DDLType type)
        {
            DDLContainer dc = new DDLContainer();

            DataSet ds = null;
            
            switch (type)
            {
                case DDLType.CONTAINER_ID:
                    ds = LabTestDA.GetDDLItems("CONTAINER");
                    dc.ItemNameString = "CONTAINER_TYPE";
                    dc.ItemValueString = "CONTAINER_ID";
                    break;
                case DDLType.DIVISION_ID:
                    ds = LabTestDA.GetDDLItems("DIVISION");
                    dc.ItemNameString = "DIVISION";
                    dc.ItemValueString = "DIVISION_ID";
                    break;
                case DDLType.FUNC_AREA_ID:
                    ds = LabTestDA.GetDDLItems("FUNCTIONAL_AREA");
                    dc.ItemNameString = "FUNC_AREA";
                    dc.ItemValueString = "FUNC_AREA_ID";
                    break;
                case DDLType.SPEC_TYPE_ID:
                    ds = LabTestDA.GetDDLItems("SPECIMEN");
                    dc.ItemNameString = "SPEC_TYPE";
                    dc.ItemValueString = "SPEC_TYPE_ID";
                    break;
                case DDLType.SPECIMEN_TYPE_ID:
                    ds = LabTestDA.GetDDLItems("WEBSPECIMEN");
                    dc.ItemNameString = "SPECIMEN_TYPE";
                    dc.ItemValueString = "SPECIMEN_TYPE_ID";
                    break;
                case DDLType.TESTING_SCHEDULE_ID:
                    ds = LabTestDA.GetDDLItems("TEST_SCHEDULE");
                    dc.ItemNameString = "TESTING_SCHEDULE";
                    dc.ItemValueString = "TESTING_SCHEDULE_ID";
                    break;
                case DDLType.WEB_TAT_ID:
                    ds = LabTestDA.GetDDLItems("WEBTAT");
                    dc.ItemNameString = "WEB_TAT";
                    dc.ItemValueString = "WEB_TAT_ID";
                    break;
                case DDLType.METHOD_ID:
                    ds = LabTestDA.GetDDLItems("METHOD");
                    dc.ItemNameString = "METHOD";
                    dc.ItemValueString = "METHOD_ID";
                    break;
                case DDLType.INTERNATIONAL_UNIT_ID:
                    ds = LabTestDA.GetDDLItems("WEBUNITS");
                    dc.ItemNameString = "INTERNATIONAL_UNIT";
                    dc.ItemValueString = "INTERNATIONAL_UNIT_ID";
                    break;
                case DDLType.REF_CONV_ID:
                    ds = LabTestDA.GetDDLItems("REFCONF");
                    dc.ItemNameString = "REF_CONV";
                    dc.ItemValueString = "REF_CONV_ID";
                    break;
                case DDLType.DOWN_REQ_ID:
                    ds = LabTestDA.GetDDLItems("DOWNTIME_REQ");
                    dc.ItemNameString = "DOWN_REQ";
                    dc.ItemValueString = "DOWN_REQ_ID";
                    break;
                case DDLType.SHIPPING_ID:
                    ds = LabTestDA.GetDDLItems("SHIPPING");
                    dc.ItemNameString = "SHIPPING_DESCRIPTION";
                    dc.ItemValueString = "SHIPPING_ID";
                    break;
                case DDLType.ULT_REQ_ID:
                    ds = LabTestDA.GetDDLItems("SHIPPING");
                    dc.ItemNameString = "SHIPPING_DESCRIPTION";
                    dc.ItemValueString = "SHIPPING_ID";
                    break;
                case DDLType.WEBDISCLAIMER_ID:
                    ds = LabTestDA.GetDDLItems("DISCLAIMER");
                    dc.ItemNameString = "SUMMARY";
                    dc.ItemValueString = "WEBDISCLAIMER_ID";
                    break;
                default:
                    break;
            }

            dc.DS = ds;

            return dc;
        }

    }

}
